
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package bankapplicationgui;

import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;

/**
 *
 * @author harshi
 */
public class BankApplicationGUI extends JFrame implements ActionListener{
    JPanel loginPanel;
    JLabel labelUserName;
    JTextField textUserName;
    JLabel labelPassword;
    JPasswordField textPassword;
    JButton buttonSignIn;
    JButton buttonExit;
    GridLayout grid;

    public BankApplicationGUI(){
        
        grid=new GridLayout(3,2,3,3);
        loginPanel=new JPanel(grid);
        
        labelUserName=new JLabel("User Name");
        labelPassword=new JLabel("Password");
        textUserName=new JTextField(5);
        textPassword=new JPasswordField(5);
        buttonSignIn=new JButton("SignIn");
        buttonExit=new JButton("Exit");
        
        loginPanel.add(labelUserName);
        loginPanel.add(textUserName);
        loginPanel.add(labelPassword);
        loginPanel.add(textPassword);
        loginPanel.add(buttonSignIn);
        loginPanel.add(buttonExit);
        
        add(loginPanel);
        
        setSize(300,200);
        setVisible(true);
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        
        buttonSignIn.addActionListener(this);
        buttonExit.addActionListener(this);
    }
    
    @Override
    public void actionPerformed(ActionEvent ae){        
        String evt=ae.getActionCommand();
        if(evt.equals("SignIn")){
            SignInFrame s=new SignInFrame();
            this.dispose();
        }
       
        if(evt.equals("Exit")){
            System.exit(0);
        }
    }
}